#include<stdio.h>
#include<stdlib.h>
int main()
{
	int t,n,j,a[100],i,time;
	scanf("%d",&t);
	for(i=0;i<t;i++)
	{
		scanf("%d",&n);
		a[0]=0;
		for(j=1;j<=n;j++)
		{
			scanf("%d",&a[j]);
		}
		time=0;
		for(j=0;j<n;j++)
		{
			if(a[j]<a[j+1])
			{
				time=time+(a[j+1]-a[j])*6;
			}
			else
			{
				time=time+(a[j]-a[j+1])*4;
			}
			time=time+5;
		}
		printf("%d\n",time);
	}
	return 0;
}
